
$(function() {	
	Tip.emp('员工');
	
	_change("input[id='name_s']:visible", "select[id^='name_t']:visible");
});

var Log = {

	popup: function (e, p2, id) {
		$.cookie('id_', id);

		p2 = query(p2);
		$.cookie('p2', p2);
		
		var c1 = 'wifi.php?do=Log.edit&id=' + id;
		var c2 = 'wifi.php?do=Log.view&id=' + id;
		
		var a1 = ['编辑信息', 'url', 'Log.dialog_edit_', '650x400'];
		var a2 = ['查看信息', 'url', 'Common.dialog_view_', '650x400'];
		
		var s = c1 + ", " + c2;

		popup(e, [a1, a2], s);
	},

	dialog_edit_: function (url, title, xy) {
		var result = Common.result();
		$('#dialog_edit').dialog('option', 'buttons', {			
			"关闭": function() {
				$(this).dialog("close");
			},
	
			"修改": function() {
				if (!confirm("确认是否提交？")) {
					return false;
				}
	
				var form = $("#form_edit")[0];
	
				var body = {};
				body.id = form.id.value;
				
//				body.emp = form.emp.value;
//				body.date = form.date.value;
//				
//				body.name = form.name.value;
//				body.content = form.content.value;
				
				body.token = form.token.value;
				body.status = form.status.value;
	
				$(this).dialog("close");
	
				var url = 'wifi.php?do=Log.editPost';
				var p2 = $.cookie('p2');
				if (p2 != null) {
					url += p2;
				}
	
				$.post(url, body, function(data) {
					$(result).html(data);
				});
			}
		});
	
		dialog_edit(url, title, xy);
	},
	
	popup_all: function (e, p2) {
		p2 = query(p2);
		$.cookie('p2', p2);

		var c1 = 'wifi.php?do=Log.delete' + p2;
		var c9 = 'wifi.php?do=Log.xls' + p2;
			
		var a1 = ['删除信息', 'url', 'Common.list_delete'];
		var a9 = ['导出Excel', 'url', 'jswin', '1024x768'];

		var s = c1 + ", " + c9;

		return popup(e, [a1, a9], s);
	}
};
